<%--
  User: spolyakov
  Date: 26.07.12
  Time: 10:22
--%>

<%@ page import="net.tanesha.recaptcha.ReCaptcha" %>
<%@ page import="net.tanesha.recaptcha.ReCaptchaFactory" %>

<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<div id="content">

    <h2><spring:message code="label.takeUserReg"/></h2>

    <br/>

    <c:if test="${not empty param}">

        <h3 id="error"><spring:message code="error.reg"/></h3>
        <spring:message code="error.reqMsg"/>
        <br/> <br/>
    </c:if>

    <div style="width: 20%;" align="right">

        <form action="makeReg" method="post">
            <form:form commandName="new_user">

                <spring:message code="label.email"/>:
                <form:errors path="email" id="error"/>
            <label>
                <form:input path="email"/>
            </label>
            <br/>

                <spring:message code="label.password"/>:
                <form:errors path="password" id="error"/>
                <form:password path="password"/>
            <br/>

                <spring:message code="label.confirmPassword"/>:
            <input type="password" name="confPassword"/>
            <br/> <br/>

                <%-- Если в сессии нет флага пройденной капчи, то отображаем её.    --%>

            <c:if test="${!sessionScope.capcha_right}">

                    <%! ReCaptcha c = ReCaptchaFactory.newReCaptcha("6LcvSdQSAAAAABeD21dN62BP31dIaTtOYs4EId00", "6LcvSdQSAAAAAKMqLAmy4P5Xu4Oyf7oeFyZLxK4k", false); %>
                    <%= c.createRecaptchaHtml(null, null) %>

            </c:if>
            <c:if test="${capcha_right}">
                <spring:message code="capcha.right.message"/>
            </c:if>

            <br/> <br/>
            <input type="submit" value='<spring:message code="label.takeUserReg" /> ' id="button_c">

            </form:form>
    </div>

</div>
